import pandas as pd
import os
import json


def read_excel(base_url):
    fp = os.path.join(os.path.dirname(os.path.abspath(".")), "data\\interface-tax.xlsx")
    df = pd.read_excel(fp)
    data = []
    for i in df.index.values:
        row = df.loc[
            i, ["url", "request_method", "request_header",
                "request_parameter", "expected", 'module']].to_dict()
        row["url"] = base_url + row["url"]
        # row['request_header'] = json.loads(row['request_header']) if not isinstance(row['request_header'],
        #                                                                             float) else ''
        # row['request_header']['Cookie'] = {'Cookie': json.loads(row['request_header']['Cookie'])}
        row['request_parameter'] = json.loads(row['request_parameter'])
        data.append(row)
    return data


read_excel("http://192.168.1.62:8030")
